#include "stock10.h"
#include <iostream>
const int STKS = 4;
int main(int argc, char const *argv[])
{
    Stock stocks[STKS] = {
        Stock("stock01", 12, 20.0),
        Stock("stock02", 200, 2.0),
        Stock("stock03", 130, 3.25),
        Stock("stock04", 60, 6.5)
    };
    for (int i = 0; i < STKS; i++)
    {
        stocks[i].show();
    }

    const Stock * top = &stocks[0];
    int i;
    for (i = 1; i < STKS; i++)
    {
        // 注意，这里有个取址操作 &
        top = &top->topval(stocks[i]);
    }
    std::cout << "TOP" << std::endl;
    top->show();
    
    
    return 0;
}
